//
//  OperationOnlineCell.m
//  MonitoringNetwork
//
//  Created by admin on 2017/12/22.
//  Copyright © 2017年 wtmcxlm. All rights reserved.
//

#import "OperationOnlineCell.h"

@interface OperationOnlineCell()
@property (nonatomic,strong)UILabel *onlineLabel;
@property (nonatomic,strong)UILabel *onlineRateLabel;
@property (nonatomic,strong)UILabel *label2;
@property (nonatomic,strong)UILabel *label3;
@end

@implementation OperationOnlineCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    UIView *backView = [UIView new];
    backView.backgroundColor = [UIColor colorWithRed:0.97f green:0.97f blue:0.97f alpha:1.00f];
    [self addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(self);
        make.height.mas_equalTo(11);
    }];
    _label2 = [UILabel LabelWithFont:TitleLagerFontSize andColor:TitleColor andTextAlignment:left andString:@"行驶数"];
    [self addSubview:_label2];
    [_label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(33);
        make.bottom.mas_equalTo(self.mas_top).offset(47);
    }];
    
    _label3 = [UILabel LabelWithFont:TitleLagerFontSize andColor:TitleColor andTextAlignment:left andString:@"行驶率"];
    [self addSubview:_label3];
    [_label3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_centerX).offset(0);
        make.bottom.mas_equalTo(self.mas_top).offset(47);
    }];
    _onlineLabel = [UILabel LabelWithFont:MaxFontSize andColor:NumColor andTextAlignment:left andString:@"0"];
    [self addSubview:_onlineLabel];
    [_onlineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_label2);
        make.bottom.mas_equalTo(self.mas_top).offset(89);
    }];
    
    _onlineRateLabel = [UILabel LabelWithFont:MaxFontSize andColor:NumColor andTextAlignment:left andString:@"0"];
    [self addSubview:_onlineRateLabel];
    [_onlineRateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_centerX).offset(0);
        make.bottom.mas_equalTo(self.mas_top).offset(89);
    }];
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
//    if (_rightData) {
//        int onlineNum = [_leftData intValue];
//        int totalNum = [_rightData intValue];
//        NSString *str = @"%";
//        double percent = (onlineNum*1.00f)/(totalNum*1.00f);
//        _onlineLabel.text = [NSString stringWithFormat:@"%d",onlineNum];
//        _onlineRateLabel.text = [NSString stringWithFormat:@"%.2lf%@",percent*100,str];
//    }
    
    _onlineLabel.text = _leftData;
    _onlineRateLabel.text = _rightData;
    
    _label2.text = _leftTitle;
    _label3.text = _rightTitle;
}


@end
